﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Business.Manager;
using Business.IManager;

namespace OnlinePayment.Admin
{
    public partial class RoleManager : System.Web.UI.Page
    {
        IAccountManager accountManager = new AccountManager();
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack){
                bindRoleAuthority();
            }
        }

        private void bindRoleAuthority()
        {
            this.roleAuthoritySet.DataSource = accountManager.getAuthorityDS();
            this.roleAuthoritySet.DataBind();
        }
        protected void gvAdmSet_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int roleId = Convert.ToInt32(this.roleAuthoritySet.Rows[e.RowIndex].Cells[0].Text);
            accountManager.deletRole(roleId);
            this.roleAuthoritySet.DataSource = accountManager.getAuthorityDS();
            this.roleAuthoritySet.DataBind();
        }

        
    }
}